package com.mentaleye.dal.dao.mybatis;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mentaleye.dal.dao.CompanyDao;
import com.mentaleye.dal.model.Company;
import com.mentaleye.dal.model.CompanyExample;
import com.mentaleye.dal.service.CompanyMapper;

@Repository
public class CompanyDaoImpl implements CompanyDao {

	@Autowired private CompanyMapper dataMapper;
	
	@Override
	public boolean insertData(Company data) {
		boolean isSuccess=false;
		if(this.dataMapper.insert(data)>0){
			isSuccess=true;
		}
		return isSuccess;
	}

	@Override
	public boolean updateData(Company data) {
		boolean isSuccess=false;
		if(this.dataMapper.updateByPrimaryKey(data)>0){
			isSuccess=true;
		}
		return isSuccess;
	}

	@Override
	public List<Company> getListByExample(CompanyExample example) {
		return this.dataMapper.selectByExample(example);
	}

	@Override
	public List<Map<String,Object>> getListByMap(Map<String, Object> map) {
		return this.dataMapper.getListByMap(map);
	}

	@Override
	public boolean deleteByExample(CompanyExample example) {
		boolean isSuccess=false;
		if(this.dataMapper.deleteByExample(example)>0){
			isSuccess=true;
		}
		return isSuccess;
	}

}
